package com.bookstore;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Locale;

@WebServlet(name = "DemoServlet06", value = "/DemoServlet06")
public class DemoServlet06 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String contextPath = request.getContextPath();
        String requestURI = request.getRequestURI();
        int localPort = request.getLocalPort();
        String protocol = request.getProtocol();//获取协议 protocol数据传输协议
        String localAddr = request.getLocalAddr();
        String localName = request.getLocalName();
        Locale locale = request.getLocale();
        long contentLengthLong = request.getContentLengthLong();
        String remoteHost = request.getRemoteHost();
        System.out.println(remoteHost);
        System.out.println(contentLengthLong);
        System.out.println(locale);
        System.out.println(localName);
        System.out.println(localAddr);
        System.out.println(protocol);
        System.out.println(contextPath);
        System.out.println(requestURI);
        System.out.println(localPort);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getContentLength();
    }
}
